home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ddj0897.zip
/
DYN401.ZIP
/
class
/
ushrtint.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-16
|
6KB
|
194 lines
/* Copyright (c) 1993-1996 Algorithms Corporation */
/* All rights reserved. */
/* This file automatically generated by dpp - do not edit */
#define DPP_STRATEGY 2
#define DPP_FASTWIDE 0
#line 15 "ushrtint.d"
#include <math.h>
#define CLASS UnsignedShortInteger_c
#define ivType UnsignedShortInteger_iv_t
#include "generics.h"
object UnsignedShortInteger_c;
#line 28 "ushrtint.c"
typedef struct _UnsignedShortInteger_iv_t {
unsigned short int iVal;
} UnsignedShortInteger_iv_t;
#line 21 "ushrtint.d"
cmeth objrtn UnsignedShortInteger_cm_gNewWithUnsigned(object self, unsigned val)
{
object obj = oSuper(UnsignedShortInteger_c, gNew, self)(self);
ivType *iv = ivPtr(obj);
iv->iVal = (unsigned short int) val;
return(obj);
}
imeth int UnsignedShortInteger_im_gHash(object self)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
double t;
t = .6125423371 * iv->iVal;
t = t < 0.0 ? -t : t;
return (int) (BIG_INT * (t - floor(t)));
}
imeth int UnsignedShortInteger_im_gCompare(object self, object obj)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
unsigned short sv, ov;
ChkArg(obj, 2);
if (ClassOf(obj) != CLASS)
return oSuper(UnsignedShortInteger_c, gCompare, self)(self, obj);
if ((sv=iv->iVal) < (ov=ivPtr(obj)->iVal))
return -1;
else if (sv == ov)
return 0;
else
return 1;
}
imeth objrtn UnsignedShortInteger_im_gStringRepValue(object self)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
return vSprintf(String, "%hu", iv->iVal);
}
imeth char UnsignedShortInteger_im_gCharValue(object self)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
return (char) iv->iVal;
}
imeth short UnsignedShortInteger_im_gShortValue(object self)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
return (short) iv->iVal;
}
imeth unsigned short UnsignedShortInteger_im_gUnsignedShortValue(object self)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
return (unsigned short) iv->iVal;
}
imeth long UnsignedShortInteger_im_gLongValue(object self)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
return (long) iv->iVal;
}
imeth double UnsignedShortInteger_im_gDoubleValue(object self)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
return (double) iv->iVal;
}
imeth void * UnsignedShortInteger_im_gPointerValue(object self)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
return (void *) &iv->iVal;
}
imeth objrtn UnsignedShortInteger_im_gChangeValue(object self, object val)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
ChkArg(val, 2);
iv->iVal = gUnsignedShortValue(val);
return self;
}
imeth objrtn UnsignedShortInteger_im_gChangeCharValue(object self, int val)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
iv->iVal = (unsigned short) val;
return self;
}
imeth objrtn UnsignedShortInteger_im_gChangeShortValue(object self, int val)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
iv->iVal = (unsigned short) val;
return self;
}
imeth objrtn UnsignedShortInteger_im_gChangeUShortValue(object self, unsigned val)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
iv->iVal = (unsigned short) val;
return self;
}
imeth objrtn UnsignedShortInteger_im_gChangeLongValue(object self, long val)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
iv->iVal = (unsigned short) val;
return self;
}
imeth objrtn UnsignedShortInteger_im_gChangeDoubleValue(object self, double val)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
iv->iVal = (unsigned short) val;
return self;
}
#line 141 "ushrtint.c"
objrtn UnsignedShortInteger_initialize(void)
{
static CRITICALSECTION cs;
static int volatile once = 0;
ENTERCRITICALSECTION(_CI_CS_);
if (!once) {
INITIALIZECRITICALSECTION(cs);
once = 1;
}
LEAVECRITICALSECTION(_CI_CS_);
ENTERCRITICALSECTION(cs);
if (UnsignedShortInteger_c) {
LEAVECRITICALSECTION(cs);
return UnsignedShortInteger_c;
}
INHIBIT_THREADER;
Number_initialize();
if (UnsignedShortInteger_c) {
ENABLE_THREADER;
LEAVECRITICALSECTION(cs);
return UnsignedShortInteger_c;
}
UnsignedShortInteger_c = gNewClass(Class, "UnsignedShortInteger", sizeof(UnsignedShortInteger_iv_t), 0, Number, END);
cMethodFor(UnsignedShortInteger, gNewWithUnsigned, UnsignedShortInteger_cm_gNewWithUnsigned);
iMethodFor(UnsignedShortInteger, gUnsignedShortValue, UnsignedShortInteger_im_gUnsignedShortValue);
iMethodFor(UnsignedShortInteger, gChangeDoubleValue, UnsignedShortInteger_im_gChangeDoubleValue);
iMethodFor(UnsignedShortInteger, gDoubleValue, UnsignedShortInteger_im_gDoubleValue);
iMethodFor(UnsignedShortInteger, gCompare, UnsignedShortInteger_im_gCompare);
iMethodFor(UnsignedShortInteger, gChangeLongValue, UnsignedShortInteger_im_gChangeLongValue);
iMethodFor(UnsignedShortInteger, gChangeShortValue, UnsignedShortInteger_im_gChangeShortValue);
iMethodFor(UnsignedShortInteger, gShortValue, UnsignedShortInteger_im_gShortValue);
iMethodFor(UnsignedShortInteger, gPointerValue, UnsignedShortInteger_im_gPointerValue);
iMethodFor(UnsignedShortInteger, gCharValue, UnsignedShortInteger_im_gCharValue);
iMethodFor(UnsignedShortInteger, gStringRepValue, UnsignedShortInteger_im_gStringRepValue);
iMethodFor(UnsignedShortInteger, gChangeUShortValue, UnsignedShortInteger_im_gChangeUShortValue);
iMethodFor(UnsignedShortInteger, gHash, UnsignedShortInteger_im_gHash);
iMethodFor(UnsignedShortInteger, gChangeValue, UnsignedShortInteger_im_gChangeValue);
iMethodFor(UnsignedShortInteger, gLongValue, UnsignedShortInteger_im_gLongValue);
iMethodFor(UnsignedShortInteger, gChangeCharValue, UnsignedShortInteger_im_gChangeCharValue);
ENABLE_THREADER;
LEAVECRITICALSECTION(cs);
return UnsignedShortInteger_c;
}